<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class M_search extends CI_Model{
    function __construct(){
        parent::__construct();
    }
    function tampil(){
    //$this->db->from('mahasiswa');
        $this->db->select('*');
        $this->db->from('jb_barang');
        $this->db->join('jb_category','jb_category.ID_Kategori = jb_barang.ID_Kategori');
        $query = $this->db->get();
        return $query->result(); 
    }
    function caridata(){
        $c = $this->input->POST ('cari');
        $this->db->select('*');
        $this->db->from('jb_barang');
        $this->db->join('jb_category','jb_category.ID_Kategori = jb_barang.ID_Kategori');
        $this->db->like('Judul', $c,'both');
        $this->db->or_like('Deskripsi',$c,'both');
        $query = $this->db->get();
        return $query->result(); 
    }
}